package ;

import henkolib.events.Event;
import henkolib.events.EventArgs;
import henkolib.events.IPublicEvent;
import henkolib.events.SimpleEvent;
import henkolib.events.IPublicSimpleEvent;

/**
 * @author Henko
 */

class LogData
{
	public var Message(default, null) : String;
	public function new(message : String)
	{
		this.Message = message;
	}
}

class Point
{
	public var X(default, null) : Int;
	public var Y(default, null) : Int;
	public function new(x : Int, y : Int)
	{
		this.X = x;
		this.Y = y;
	}
	public function toString()
	{
		return "(" + X + ", " + Y + ")";
	}
}

class SampleEventClass 
{
	private var onsignal : SimpleEvent;
	private var onlog : Event<LogData>;
	private var ondata : Event<Point>;
	
	public var onSignal(default, null) : IPublicSimpleEvent;
	public var onLog(default, null) : IPublicEvent<LogData>;
	public var onData(default, null) : IPublicEvent<Point>;
	
	public function new() 
	{
		onsignal = new SimpleEvent();
		onlog = new Event<LogData>();
		ondata = new Event<Point>();
		
		onSignal = onsignal;
		onLog = onlog;
		onData = ondata;
	}
	
	public function RaiseSignal()
	{
		onsignal.Invoke();
	}
	
	public function RaiseLog(message : String)
	{
		onlog.Invoke(new EventArgs(new LogData(message), this));
	}
	
	public function RaiseData(x : Int, y : Int)
	{
		ondata.Invoke(new EventArgs(new Point(x, y)));
	}	
}